package com.mt.demo.service.impl;

import com.mt.demo.util.DateUtils;
import com.mt.demo.domain.MtVoteRecord;
import com.mt.demo.mapper.MtVoteRecordMapper;
import com.mt.demo.service.IMtVoteRecordService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * 投票记录Service业务层处理
 * 
 * @author gary
 * @date 2025-08-11
 */
@Service
public class MtVoteRecordServiceImpl implements IMtVoteRecordService 
{
    @Autowired
    private MtVoteRecordMapper mtVoteRecordMapper;

    /**
     * 查询投票记录
     * 
     * @param recordId 投票记录主键
     * @return 投票记录
     */
    @Override
    public MtVoteRecord selectMtVoteRecordByRecordId(Long recordId)
    {
        return mtVoteRecordMapper.selectMtVoteRecordByRecordId(recordId);
    }

    /**
     * 查询投票记录列表
     * 
     * @param mtVoteRecord 投票记录
     * @return 投票记录
     */
    @Override
    public List<MtVoteRecord> selectMtVoteRecordList(MtVoteRecord mtVoteRecord)
    {
        return mtVoteRecordMapper.selectMtVoteRecordList(mtVoteRecord);
    }

    /**
     * 新增投票记录
     * 
     * @param mtVoteRecord 投票记录
     * @return 结果
     */
    @Override
    public int insertMtVoteRecord(MtVoteRecord mtVoteRecord)
    {
        mtVoteRecord.setCreateTime(DateUtils.getNowDate());
        return mtVoteRecordMapper.insertMtVoteRecord(mtVoteRecord);
    }

    /**
     * 修改投票记录
     * 
     * @param mtVoteRecord 投票记录
     * @return 结果
     */
    @Override
    public int updateMtVoteRecord(MtVoteRecord mtVoteRecord)
    {
        mtVoteRecord.setUpdateTime(DateUtils.getNowDate());
        return mtVoteRecordMapper.updateMtVoteRecord(mtVoteRecord);
    }

    /**
     * 批量删除投票记录
     * 
     * @param recordIds 需要删除的投票记录主键
     * @return 结果
     */
    @Override
    public int deleteMtVoteRecordByRecordIds(Long[] recordIds)
    {
        return mtVoteRecordMapper.deleteMtVoteRecordByRecordIds(recordIds);
    }

    /**
     * 删除投票记录信息
     * 
     * @param recordId 投票记录主键
     * @return 结果
     */
    @Override
    public int deleteMtVoteRecordByRecordId(Long recordId)
    {
        return mtVoteRecordMapper.deleteMtVoteRecordByRecordId(recordId);
    }
}
